const http = require('http');
//读模块
const fs = require('fs');
//处理路径
const path = require('path');

//创建服务器
http.createServer((req,res) => {
    if(req.url === '/'){
        fs.readFile(path.join(__dirname,'WWW','index.css'),(err,data) => {
            if(err){
                console.log('出错了');
                res.end();
            }else{
                res.write(data);
                res.end();
            }
        })
    }
}).listen(8080,() => {
    console.log(' --->','服务器已启动！！');
})